import * as importPlugin from 'eslint-plugin-import-x'
import { FlatConfig, OptionsOverrides } from '../types'

export default async ({ overrides = {} }: OptionsOverrides = {}): Promise<FlatConfig[]> => [
  {
    name: 'vill-v/imports',
    plugins: {
      import: importPlugin,
    },
    settings: {
      'import/resolver': {
        node: { extensions: ['.js', '.mjs'] },
      },
    },
    rules: {
      // ...importPlugin.configs.recommended.rules,
      'import/order': 'error',
      'import/first': 'error',
      'import/no-amd': 'error',
      'import/no-unresolved': 'off',
      'import/no-absolute-path': 'off',
      'import/newline-after-import': ['error', { count: 1, considerComments: true }],
      'import/no-named-as-default-member': 'off',
      'import/no-named-as-default': 'off',
      'import/namespace': 'off',
      ...overrides,
    },
  },
]
